<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/share/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>绑定序号</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<%@ include file="/WEB-INF/share/wechat.jsp"%>
</head>
<body>
	<%@ include file="/WEB-INF/share/wechattop.jsp"%>
	<div class="mui-content">
		<div class="mui-control-content mui-active">
			<div class="header">
				<h3>我的序号</h3>
			</div>
			<ul class="mui-table-view">
				<li class="mui-table-view-cell">
					<div style="justify-content: space-between" class="box">
						<div style="flex:1;">序号:</div>
						<div style="flex:2;"><input id="xh" type="text" placeholder="请输入序号" style="height: 30px;line-height:30px;font-size:20px;outline: none;border: none;margin-bottom: auto;"/>
						</div>
					</div>
				</li>
				<li class="mui-table-view-cell">
						<div class="mui-media-body">
							<div style="font-size: 0.32rem; margin: auto;"
								class="box box-align-left">
								<button onclick="bindcode();" type="button" class="mui-btn mui-btn-primary">绑定</button>
							</div>
						</div>
				</li>
			</ul>
			<div style="width: 100%; height: 50px"></div>
		</div>
	</div>
	<%@ include file="/WEB-INF/share/wechatscript.jsp"%>
	<script>
		var url = '${url}';
		var dourl = "${ctx}/wx/index";
		function bindcode() {
			var xh = $('#xh').val();
			if(!xh){
				alert('请输入序号!');
				return;
			}
			$.ajax({
				type : "POST",
				url : "${ctx}/wx/savebindxh",
				data : {
					xh : xh
				},
				dataType : "json",
				success : function(data) {
					if (data.type === 1) {
						layer.open({
							content : '保存成功',
							skin : 'msg',
							time : 2
						});
						setTimeout(function() {
							location.href = dourl;
						}, 1000);
						return;
					}
					layer.open({
						content : data.message,
						skin : 'msg',
						time : 2
					});
				}
			});

		}
		function buycode(url) {
			location.href = url;
		}
	</script>
</body>
</html>
